<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>h=13</div>
</body>
</html>
<script>
    var div=document.querySelector('div')
    var h=new Date().getHours()
    if(h<6){
        console.log();('凌晨好');
    }else if(h<9){
        console.log('早上好');
    }else if(h<12){
        console.log('上午好');
    }else if(h<14){
        console.log('中午好');
    }else if(h<17){
        console.log('下午好');
    }else if(h<19){
        console.log('傍晚好');
    }else if(h<22){
        console.log('晚上好');
    }
</script>